<?php

class My_Acl extends Zend_Acl
{
    public function __construct(Zend_Auth $auth)
    {
        // Add Resources
        // Resource #1: Default Module
        $this->add(new Zend_Acl_Resource('default'));
        // Resource #2: User Module
        $this->add(new Zend_Acl_Resource('user'));
        // Resource #3: Admin Module
        $this->add(new Zend_Acl_Resource('admin'));

        // Add Roles
        // Role #1: Guest
        $this->addRole(new Zend_Acl_Role('guest'));
        // Role #2: Member (inherits from Guest)
        $this->addRole(new Zend_Acl_Role('member'), 'guest');
        // Role #3: Administrator (inherits from Member)
        $this->addRole(new Zend_Acl_Role('administrator'), 'member');

        // Assign Access Rules
        // Guests can access Default Module (Member inherits this)
        $this->allow('guest', 'default');
        // Members can access User Module (Administrator inherits this)
        $this->allow('member', 'user');
        // Administrator can access Admin Module
        $this->allow('administrator', 'admin');
    }
}